#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time: 2022/12/22 10:14
# @Author: scg
# @Email: xxx@gmail.com
# @File：login_page.py
from selenium.webdriver.common.by import By
from pages.base_page import BasePage


class LoginPage(BasePage):
    url = "/crm/index.php?m=user&a=login"

    name_locator = (By.NAME, 'name')
    password_locator = (By.NAME, 'password')
    login_btn_locator = (By.NAME, 'submit')

    def input_name(self, username):
        self.driver.find_element(*self.name_locator).send_keys(username)

    def input_password(self, password):
        self.driver.find_element(*self.password_locator).send_keys(password)

    def click_login_btn(self):
        self.driver.find_element(*self.login_btn_locator).click()
